//
// video_server_common.h
//

#pragma once

#include <packet_queue.h>
#include <uthash.h>

#define MAX_AVPACKET_SIZE 1024 * 1024
#define MAX_CLIENTS 10
#define SUCCESSFUL_BIND 0
#define SUCCESSFUL_UNBIND 0
#define UNSUCCESSFUL_BIND -1
#define UNSUCCESSFUL_UNBIND -1

// A single client-video bind object
typedef struct video_client_bind_t {
	int 			client_fd;
	struct PacketQueue 	queue;
	char 			buffer[MAX_AVPACKET_SIZE];
	int			buffer_pos;
	UT_hash_handle 		hh;
} video_client_bind_t;

// A struct of delegates for video action handling from the select server
typedef struct video_player_events_t {
	int (*on_client_connected) (struct video_client_bind_t*);
	int (*on_client_disconnected) (struct video_client_bind_t*);
} video_player_events_t;
